-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(system-server): add /system/oem_mode/upload_splash endpoint to change boot splash #14865
Conversation
…bleOEMMode feature flag is changed.
make sure robot type is RobotTypeEnum.FLEX when setting the enableOEMMode
file_size = 0 | ||
for chunk in file.file: | ||
file_size += len(chunk) | ||
if file_size > 5242880: # 5MB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we make this the literal sequence 5 * 1024 * 1024
dont process upload_splash endpoint unless oem mode has been enabled add filetype package
add import-untyped for typefile import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and links together as expected based on robot-server side changes as well, flow for client->system server endpoint relationship makes sense from discussions on how the behavior is split between the two.
detail="File is larger than 5mb.", | ||
) | ||
|
||
# TODO: Validate image dimensions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This TODO can be removed since we will no longer be validating dimensions on this side.
status.HTTP_201_CREATED: {"message": "OEM Mode splash screen uploaded"}, | ||
status.HTTP_400_BAD_REQUEST: {"message": "OEM Mode splash screen not set"}, | ||
status.HTTP_413_REQUEST_ENTITY_TOO_LARGE: { | ||
"message": "File is larger than 5mb" | ||
}, | ||
status.HTTP_415_UNSUPPORTED_MEDIA_TYPE: {"message": "Invalid file type"}, | ||
status.HTTP_500_INTERNAL_SERVER_ERROR: { | ||
"message": "OEM Mode splash unhandled exception." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Status responses all make sense and are error codes in line with what would reasonably be expected on receiving end.
…hange the userspace boot screen. (#14865)
Overview
Now that we can enable/disable OEM mode, we need an endpoint to upload an image file which will become the splash screen. This pull request adds the endpoint, which takes a file and validates it to make sure it's a PNG image, < 5 MB in size, and is 1024x600 in dimension. Once validated, the file is saved to its final location in
/var/lib/opentrons-system-server/oem_mode/{filename}
then we updateOT_SYSTEM_SERVER_oem_mode_splash_custom
dotenv file with the same location.Closes: PLAT-277
Test Plan
/var/lib/opentrons-system-server/oem_mode/{filename}
OT_SYSTEM_SERVER_oem_mode_splash_custom
to/var/lib/opentrons-system-server/oem_mode/{filename}
in thesystem.env
fileChangelog
/system/oem_mode/upload_splash
endpoint to the system serverReview requests
Risk assessment
Low, unreleased